var process = function(data, target) {
	if (data.sended == false) {
		$('#utility-form').html('<p align="center">' + data.message + '</p>');
    }
    else {
    	//add message
    	$('p').fadeOut();
		$('#utility-form').html('<div align="center">' + data.message + '</div>');
		$('#submitter').fadeOut(function () {
			$(this).remove();
			//create button
	    	jQuery('#cancel').val(JAVASCRIPT_CLOSE_WINDOW);
			$('#documentresponse').empty();
		});
	}
};


$(document).ready(function () {
	
	//change editor
	$(".editor").cleditor({
		height:       150,
		bodyStyle:    "margin:4px; font:10px Arial,Verdana; cursor:text"
	});
	
	$(document).keypress(function (e) {
		key = (e.keyCode) ? e.keyCode : e.which;
		if (key === 13) {
			$('form').submit();
		}
	});
	
	$('.emails').click(function() {
		$(this).fadeOut(500, function() {
			$('#removedemails').val($('#removedemails').val() + ';' + $(this).attr('id'));
		});
	});
});